<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <script src="./vue.js"></script>
    </head>
    <style>
        
    </style>
    <body>
        <div id="app">
            <cpn></cpn>
            <cpn></cpn>
            <cpn></cpn>
        </div>
        
    </body>
    <template id="cpnC">
        <div>
            <button @click="jian" :disabled="num <= 0">-</button>
            <input type="text" v-model="num">
            <button @click="jia">+</button>
        </div>
    </template>
    <script>
        
        Vue.component('cpn',{
            template:"#cpnC",
            data () {
                return {
                    num:0
                }
            },
            methods: {
                jia (){
                    this.num++
                },
                jian(){
                    this.num--
                }            
            }
        })
        let app = new Vue({
            el:"#app",
            data:{

            }
        })
    </script>
</html>